package crazyjava;

import java.io.BufferedReader;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;

public class ExitFinally {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		File f = new File("E:/TestFile/a.html");
		try {
			FileReader fr = new FileReader(f);
			System.out.println("资源已打开");
			BufferedReader br = new BufferedReader(fr);
			String line = null;
			try {
				while((line=br.readLine())!=null){
					System.out.println(line);
				}
				System.exit(0);
			} catch (IOException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}finally{
				if(fr!=null){
					try {
						fr.close();
					} catch (IOException e) {
						// TODO Auto-generated catch block
						e.printStackTrace();
					}
					System.out.println("资源以关闭");
				}
			}
		} catch (FileNotFoundException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}

	}

}
